<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="customer" tagdir="/WEB-INF/tags/customer"%>
<title><fmt:message key="appAdminDetail.title" />
</title>
<content tag="buttons">
	<probiz:iconBtn btnType="save" onclick="fnDoSave(this)" />
   	<c:if test="${(not empty appAdmin.appuserId)}">
   		<probiz:iconBtn btnType="resetPw" btnTextKey="button.resetPw" onclick="dlgresetPasswordDialog_show({appuserId:${appAdmin.appuserId}});"/>
   	</c:if>
</content>

<probiz:showBindErrors bindPath="appAdmin.*" />

<form class="mainForm" method="post" action="${ctxPath}/selfProfile.html" id="appAdmin" onsubmit="return validateAppAdmin(this)">
<input type="hidden" name="doAction"/>
<spring:bind path="appAdmin.appuserId">
	<input type="hidden" name="appAdminId" value="<c:out value="${status.value}"/>" />
</spring:bind>
<div class="top clearfix">
	<ul class="tab">
		<li class="curr"><span><fmt:message key="appAdminDetail.userConfig"/></span></li>
	</ul>
</div>
			<div class="modify">
				<TABLE class="com_modi_table" cellSpacing="0" cellPadding="0" width="100%" border="0">
					<tr>
						<th class="label_width_1">
							<StoreAdmin:label key="appAdmin.username" />
						</th>
						<td>
							<spring:bind path="appAdmin.username">
								<c:if test="${empty appAdmin.appuserId}">
									<input class="inputtxt" style="width:350px" maxlength="64"
										type="text" name="${status.expression}"
										id="${status.expression}" value="${status.value}" />
								</c:if>
								<c:if test="${not empty appAdmin.appuserId}">
									<c:out value="${status.value}" />
								</c:if>
							</spring:bind>
							<input class="inputtxt" style="width:350px" maxlength="64"
								type="hidden" name="password"
								value="${appAdmin.password}" />
							<input type="hidden" name="confirmPassword"
								value="${appAdmin.password}">
						</td>
					</tr>
					<tr>
						<th>
							<StoreAdmin:label key="appAdmin.firstname" />
						</th>
						<td>
							<spring:bind path="appAdmin.firstname">
								<input class="inputtxt" style="width:350px" maxlength="64"
									type="text" name="${status.expression}"
									id="${status.expression}" value="${status.value}" />
							</spring:bind>
						</td>
					</tr>

					<tr>
						<th>
							<StoreAdmin:label key="appAdmin.email" />
						</th>
						<td>
							<spring:bind path="appAdmin.email">
								<input class="inputtxt" style="width:350px" maxlength="64"
									type="text" name="${status.expression}"
									id="${status.expression}" value="${status.value}" />
							</spring:bind>
						</td>
					</tr>
					<tr>
						<th>
							<StoreAdmin:label key="appAdmin.telephone" />
						</th>
						<td>
							<spring:bind path="appAdmin.telephone">
								<input class="inputtxt" style="width:350px" maxlength="64"
									type="text" name="${status.expression}"
									id="${status.expression}" value="${status.value}" />
							</spring:bind>
						</td>
					</tr>
					<tr>
						<th>
							<StoreAdmin:label key="appAdmin.fax" />
						</th>
						<td>
							<spring:bind path="appAdmin.fax">
								<input class="inputtxt" style="width:350px" maxlength="64"
									type="text" name="${status.expression}"
									id="${status.expression}" value="${status.value}" />
							</spring:bind>
						</td>
					</tr>
					<tr>
						<th>
							<StoreAdmin:label key="appAdmin.zip" />
						</th>
						<td>
							<spring:bind path="appAdmin.zip">
								<input class="inputtxt" style="width:350px" maxlength="64"
									type="text" name="${status.expression}"
									id="${status.expression}" value="${status.value}" />
							</spring:bind>
						</td>
					</tr>
					<tr>
						<th>
							<StoreAdmin:label key="appAdmin.department" />
						</th>
						<td>
							<spring:bind path="appAdmin.department">
								<input class="inputtxt" style="width:350px" maxlength="64"
									type="text" name="${status.expression}"
									id="${status.expression}" value="${status.value}" />
							</spring:bind>
						</td>
					</tr>
					<tr>
						<th>
							<StoreAdmin:label key="appAdmin.userPosition" />
						</th>
						<td>
							<spring:bind path="appAdmin.userPosition">
								<input class="inputtxt" style="width:350px" maxlength="64"
									type="text" name="${status.expression}"
									id="${status.expression}" value="${status.value}" />
							</spring:bind>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>

</form>
<v:javascript formName="appAdmin" staticJavascript="false" />
<script type="text/javascript">
$j(document).ready(function () {
	__FMTExtend = {
		passwordReset_success:"<fmt:message key="passwordReset.success"/>",
	    appAdminDetail_password_twoField:"<fmt:message key="appAdminDetail.password.twoField"/>"
	};
	$j.extend(__FMT, __FMTExtend); 
});	

$j(document).ready(	function(){		
	$j("body").addClass('close_left');
		
	//本页面新增时验证密码
	<c:if test="${empty appAdmin.appuserId}">
		applyValidate($j("#password"),"required,minlength=6,maxlength=16");
		applyValidate($j("#confirmPassword"),"required,minlength=6,maxlength=16");
	</c:if>
});

//保存重设的密码
function saveResetPassword(){
   	var form=$j("#passwordModel");
   	if(validateForm(form.get(0))){
   		if($j('#passwordModel #password').val()!=$j('#passwordModel #confirmPassword').val()){
   			alert(__FMT.appAdminDetail_password_twoField);
   		}else{
	   		var paramData=form.serializeArray();
	   		function afterPost(data){
	   			if (data.error == null) {
	   				setTimeout("alert(__FMT.passwordReset_success)", 0);
   					dlgresetPasswordDialog_close();
	   			} else {
	   				jAlert(data.error);
	   			}
	   		}
	   		$j.post(__ctxPath+"/system/appAdmin/blank.html?doAction=saveResetPassword",paramData,afterPost,"json");
   		}
   	}
}


</script>
<%---------------------------------start:重设密码 -------------------------%>
<div style="display:none">
	<fmt:message key="button.save" var="buttonSave"/>
	<fmt:message key="button.cancel" var="buttonCancel"/>
	<fmt:message key="appUser.password.reset.title" var="title"/>
	<probiz:ui_dialog id="resetPasswordDialog" width="640" height="220" title="${title}"
		url="${ctxPath}/system/appAdmin/dialog.html?doAction=resetPassword" buttons="'${buttonSave}':saveResetPassword,'${buttonCancel}':dlgresetPasswordDialog_close" />
</div>
<%---------------------------------end:  重设密码 -------------------------%>
